<template>
	<view class="main">
		<uni-nav-bar title="项目合同列表" background-color="#007AFF" color="#000" statusBar="true"></uni-nav-bar>

		<scroll-view class="scrollView" scroll-y="true" @scrolltolower="handleScrolltolowerone()"
			:style="{height: setcollapseheight() + 'px'}">
			<view class="orderBox" v-for="(item,index) in dataList">
				<view class="itemBox" @click="GotoDetail(item)">
					<view class="itemContent">
						<view class="itemTitle">合同编号:</view>
						<view class="itemValue">{{item.contractNo}}</view>
					</view>
					<view class="itemContent">
						<view class="itemTitle">合同名称:</view>
						<view class="itemValue">{{item.contract&&item.contract.contractName||'--'}}</view>
					</view>
					<view class="itemContent">
						<view class="itemTitle">上传日期:</view>
						<view class="itemValue">{{item.uploadDate||'--'}}</view>
					</view>
				</view>
				<view class="btnBox">
					<view @click="ReviewQuotations(item,'查看详情')" class="review">
						查看详情
					</view>

				</view>
			</view>
			<view v-if="!dataList.length">
				<u-empty mode="message" icon="http://cdn.uviewui.com/uview/empty/message.png">
				</u-empty>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import bottomBar from "@/components/socialized-bottomtabar/home-bottomtabar"
	import orderCenterApi from '@/api/socialized-servce/order-center/index.js'
	import OrderItem from "./components/order-item.vue"
	export default {
		components: {
			bottomBar,
			OrderItem
		},
		data() {
			return {
				page: 1,
				size: 10,
				total: 0,
				totalPages: 0,
				dataList: [],
			}
		},
		onLoad(e) {
			this.dataList = [{

			}]
			console.log(e);
		},
		mounted() {
			this.setcollapseheight()
		},
		methods: {
			ReviewQuotations(item) {
				let url = '/pages/socialized-service/order-center/contract-list-detail'
				this.$togo(url, item)
			},

			setcollapseheight() {
				let topheightone = uni.upx2px(136)
				let winHeight = 0
				uni.getSystemInfo({
					success: function(res) {
						winHeight = res.windowHeight
					}
				});
				let oldHeight = uni.upx2px(156)

				winHeight = parseInt(winHeight) - topheightone - oldHeight
				// #ifndef H5
				winHeight = winHeight - 20

				// #endif
				return winHeight
			},
			handleScrolltolowerone() {
				console.log('触底', this.page, this.totalPages);
				if (this.page <= this.totalPages && this.page * 10 < this.total) {
					this.page++
					this.queryPageList()
				}
			},
		}

	}
</script>

<style lang="scss" scoped>
	.scrollView {
		// padding-top: 20rpx;
		padding: 20rpx;
		box-sizing: border-box;

		.content {
			width: 100%;
			color: #000;

			.item {
				position: relative;
				padding: 0 40rpx;
				font-size: 28rpx;
				margin-bottom: 20rpx;

				.dot {
					position: absolute;
					top: 60rpx;
					right: 52rpx;
					width: 16rpx;
					height: 16rpx;
					border-radius: 50%;
					background-color: red;
					z-index: 999;
				}

				.img {
					position: absolute;
					top: 66rpx;
					right: 60rpx;
					width: 34rpx;
				}

				.title {
					padding-bottom: 10rpx;
					border-bottom: 2rpx solid #c7c7c9;
					color: #91743E;
				}

				.brief {
					.brief-item {
						width: 100%;
					}
				}

				.sendTime {
					width: 100%;
					text-align: center;
					margin-bottom: 10rpx;
					color: #c7c7c9;
				}

				.container {
					padding: 22rpx;
					background: #FFFFFF;
					box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.05);
					border-radius: 10rpx 10rpx 10rpx 10rpx;

					.title {
						display: flex;
						font-weight: 700;
						overflow: hidden;
						font-size: 32rpx;
					}

					.brief {
						margin-top: 20rpx;
					}

					.times {
						margin-top: 26rpx;
						font-size: 28rpx;
						color: #606060;
					}
				}
			}

		}
	}

	.noData {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translateX(-50%) translateY(-50%);
		width: 100%;

		.img {
			width: 100%;
			display: flex;
			flex-direction: column;
			align-items: center;

			image {
				width: 166rpx;
				height: 153rpx;
			}

			.tex {
				font-size: 32rpx;
				font-family: Source Han Sans CN-Regular, Source Han Sans CN;
				font-weight: 400;
				color: #525252;
			}
		}

	}

	.search-box {
		margin-top: 28rpx;
		// display: flex;
		// justify-content: space-around;
		// align-items: center;

		.search-item {
			margin: 0rpx auto;
			padding-top: 10rpx;
			display: flex;
			justify-content: space-around;
			align-items: center;
			// box-sizing: border-box;

			.oneitem {
				width: 680rpx;
				height: 80rpx;
				opacity: 1;
				border-radius: 40rpx;
				background: rgba(255, 255, 255, 1);
				box-shadow: 0rpx 6rpx 12rpx rgba(0, 0, 0, 0.18);
				display: flex;
				justify-content: flex-start;
				align-items: center;
				padding: 0rpx 20rpx;
				box-sizing: border-box;
				margin: 0rpx auto;
			}

			.twoitem {
				margin: 0rpx auto;
				width: 540rpx;
				height: 80rpx;
				opacity: 1;
				border-radius: 40rpx;
				background: rgba(255, 255, 255, 1);
				box-shadow: 0rpx 6rpx 12rpx rgba(0, 0, 0, 0.18);
				display: flex;
				justify-content: flex-start;
				align-items: center;
				padding: 0rpx 20rpx;
				box-sizing: border-box;
			}
		}

		.searchbutton {
			font-size: 28rpx;
			font-family: Source Han Sans CN-Regular, Source Han Sans CN;
			font-weight: 400;
			color: #FFFFFF;
			line-height: 64rpx;
			width: 120rpx;
			height: 58rpx;
			opacity: 1;
			border-radius: 30rpx;
			background: linear-gradient(270deg, rgba(136, 172, 255, 1) 0%, rgba(33, 101, 255, 1) 100%);


		}
	}

	.orderBox {
		width: 684rpx;
		min-height: 200rpx;
		background-color: #ffffff;
		padding: 12rpx 14rpx 20rpx;
		box-sizing: border-box;
		margin: 0rpx auto;
		margin-top: 30rpx;
		left: 0rpx;
		top: 0rpx;
		width: 684rpx;
		opacity: 1;
		border-radius: 16rpx;
		background: rgba(255, 255, 255, 1);
		box-shadow: 0rpx 0rpx 12rpx rgba(0, 0, 0, 0.05);

		.orderTitle {
			height: 42rpx;
			font-size: 26rpx;
			font-weight: bold;
			letter-spacing: 0rpx;
			line-height: 42rpx;
			color: rgba(39, 39, 39, 1);
			text-align: left;
			display: flex;
			justify-content: space-between;

			.one {
				margin-left: 10rpx;
			}

			.two {
				width: calc(100% - 140rpx);
			}

			.three {
				width: 100rpx;
				color: rgba(46, 205, 151, 1);
			}
		}

		.itemBox {
			margin: 10rpx auto 0rpx;
			width: 622rpx;
			min-height: 200rpx;
			opacity: 1;
			border-radius: 10rpx;
			background: rgba(245, 246, 250, 1);
			padding: 12rpx 0rpx 12rpx 18rpx;
			box-sizing: border-box;
			display: flex;
			justify-content: space-between;
			flex-wrap: wrap;

			.itemContent {
				display: flex;
				justify-content: space-between;
				flex-wrap: wrap;
				height: 60rpx;
				line-height: 60rpx;
				font-size: 28rpx;
				font-weight: 400;
				letter-spacing: 0rpx;
				color: rgba(39, 39, 39, 1);

			}

			.itemTitle {
				width: 200rpx;
			}

			.itemValue {
				width: 400rpx;
			}
		}

		.btnBox {
			width: 100%;
			display: flex;
			justify-content: center;
			align-items: center;
			color: #ffffff;
			margin-top: 20rpx;

			.lookClose,
			.lookCompleted,
			.review,
			.del,
			.easy {
				min-width: 140rpx;
				height: 58rpx;
				line-height: 58rpx;
				border-radius: 30rpx;
				padding: 4rpx 12rpx;
				text-align: center;
				margin-left: 8rpx;
				background: linear-gradient(270deg, rgba(136, 172, 255, 1) 0%, rgba(33, 101, 255, 1) 100%);

			}

			.lookCompleted {}

			.del {
				background: linear-gradient(270deg, rgba(249, 170, 170, 1) 0%, rgba(255, 108, 108, 1) 100%);
			}

			.easy {
				background: rgba(0, 0, 0, 0.1);
				color: #999;
				border: 1rpx solid #999;
			}
		}
	}
</style>